package edu.towson.cis.cosc490.jdehlinger.lab3;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;

public class CreateToDoActivity extends Activity implements OnClickListener, OnCheckedChangeListener{

	private Button Detail_Button;
	private EditText Detail_Text;
	private String Detail_String;
	private RadioGroup Priority;
	private String priority;
	
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
        setContentView(R.layout.detailslayout);

    	Detail_Button = (Button) this.findViewById(R.id.button2);
        Detail_Button.setOnClickListener(this);       
    	
        Detail_Text = (EditText) this.findViewById(R.id.editText1);
        
        Priority = (RadioGroup) this.findViewById(R.id.radioGroup1);
        Priority.setOnCheckedChangeListener(this);

	}

    public void onCheckedChanged(RadioGroup Priority, int checkedId) {

        //String priority = null;

        switch (checkedId) {

        case R.id.radio0:

                priority = this.getResources().getString(R.string.PriorityHigh);

                break;

        case R.id.radio1:

                priority = this.getResources().getString(R.string.PriorityMed);

                break;

        case R.id.radio2:

                priority = this.getResources().getString(R.string.PriorityLow);

                break;

        }


    }



    

    
    public void onClick(View v){
    	String result = priority + ": " + Detail_Text.getText().toString();
    	Intent Bull = new Intent();
    	Bundle Jockey = new Bundle();
    	Jockey.putString("1", result);
    	Bull.putExtras(Jockey);
    	
    	
    	setResult(RESULT_OK, Bull);
    	finish();
 
    }









}
